From 467e373cda78a76a6d2e6f49bdbfe7dc02ef0a69 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 15 Mar 2004 01:03:53 +0000 Subject: [PATCH] Fix typo that resulted in unnecessarily short waypoint names. Confirmed "good" by user. --- gpsbabel/garmin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gpsbabel/garmin.c b/gpsbabel/garmin.c index e8b32bdf9..adc891c2c 100644 --- a/gpsbabel/garmin.c +++ b/gpsbabel/garmin.c @@ -394,13 +394,17 @@ waypoint_write(void) ident = global_opts.synthesize_shortnames ? mkshort(mkshort_handle, src) : wpt->shortname; - strncpy(way[i]->ident, ident, sizeof(way[i]->ident)); + /* Should not be a strcpy as 'ident' isn't really a C string, + * but rather a garmin "fixed length" buffer that's padded + * to the end with spaces. So this is NOT (strlen+1). + */ + memcpy(way[i]->ident, ident, strlen(ident)); if (global_opts.synthesize_shortnames) { xfree(ident); } way[i]->ident[sizeof(way[i]->ident)-1] = 0; if (src && strlen(src)) { - strncpy(way[i]->cmnt, src, sizeof(way[i]->cmnt)); + memcpy(way[i]->cmnt, src, strlen(src)); } way[i]->lon = wpt->longitude; way[i]->lat = wpt->latitude; -- 2.30.2